package com.oa.modules.approvalsec1.controller;

import java.util.Arrays;
import java.util.Map;


import com.oa.modules.approvalsec1.entity.InstitutionPersonEntity;
import com.oa.modules.approvalsec1.service.InstitutionPersonService;
import com.oa.modules.sys.controller.AbstractController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.oa.common.utils.PageUtils;
import com.oa.common.utils.R;



/**
 * 机构人员信息表
 *
 * @author Hankaicheng
 * @email 785297226@qq.com
 * @date 2022-05-07 12:56:11
 */
@RestController
@RequestMapping("generator/institutionperson")
@Api(tags = "机构人员信息表相关接口")
public class InstitutionPersonController extends AbstractController {
    @Autowired
    private InstitutionPersonService institutionPersonService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "列表")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = institutionPersonService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    @ApiOperation(value = "信息")
    public R info(@PathVariable("id") Integer id){
		InstitutionPersonEntity institutionPerson = institutionPersonService.getById(id);

        return R.ok().put("institutionPerson", institutionPerson);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation(value = "保存")
    public R save(@RequestBody InstitutionPersonEntity institutionPerson){
		institutionPersonService.save(institutionPerson);
        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation(value = "修改")
    public R update(@RequestBody InstitutionPersonEntity institutionPerson){
		institutionPersonService.updateById(institutionPerson);
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation(value = "删除")
    public R delete(@RequestBody String[] ids){
		institutionPersonService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
